<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>项目登录系统</title>
    <style>
        /* 确保 html/body 占满视口，为父容器全屏背景做准备 */
        html, body {
            height: 100%;
            margin: 0;
        }
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f5f5f5; /* 作为背景加载失败时的回退色 */
            
            background-image: url('./Resource/bg.png'); /* 确保文件放在 d:\C\web\resource\bg.png */
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-attachment: fixed; /* 背景固定，不随页面滚动 */
        }
        
        .login-container {
            background-color: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            width: 350px;
            margin-left: auto; /* 右对齐 */
            margin-right: 12px;
            z-index: 2; /* 确保表单显示在背景之上 */
            display: flex;
            flex-direction: column;
            justify-content: center; /* 垂直居中 */
        }
        
        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 24px;
            font-size: 24px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #555;
        }
        
        input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 16px;
        }
        
        input:focus {
            border-color: #4a90e2;
            outline: none;
        }
        
        button {
            width: 100%;
            padding: 12px;
            background-color: #4a90e2;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        button:hover {
            background-color: #3a7bc8;
        }
        
        .error-message {
            color: #e74c3c;
            font-size: 14px;
            margin-top: 5px;
            display: none;
        }

        #first {
            inset: 0; /* top:0; right:0; bottom:0; left:0; */
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        #ruler {
            /* 半透明白底 + 磨砂 (backdrop-filter) */
            background-color: rgba(255, 255, 255, 0.65);
            -webkit-backdrop-filter: blur(8px) saturate(120%);
            backdrop-filter: blur(8px) saturate(120%);
            /* 圆角与阴影 */
            border-radius: 12px;
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.5);
            /* 内外间距与滚动处理 */
            padding: 16px;
            margin: 12px;
            overflow: auto;
            padding-bottom: 0px;
        }
    </style>
</head>
<body>
    <div id="first">
        <div class="login-container">
            <h1>项目上传</h1>
            <form id="loginForm">
                <div class="form-group">
                    <label for="name">姓名</label>
                    <input type="text" id="name" name="name" placeholder="请输入您的姓名" required>
                    <div id="nameError" class="error-message">请输入有效的姓名</div>
                </div>
                <div class="form-group">
                    <label for="name">学校</label>
                    <input type="text" id="name" name="name" placeholder="请输入您的学校" required>
                    <div id="nameError" class="error-message">请输入有效的学校</div>
                </div>
            <div class="form-group">
                    <label for="idCard">身份证号</label>
                    <input type="text" id="idCard" name="idCard" placeholder="请输入18位身份证号码" required>
                    <div id="idCardError" class="error-message">请输入有效的18位身份证号码</div>
                </div>
                
                <div class="form-group">
                    <label for="projectId">编程世界ID</label>
                    <input type="text" id="projectId" name="projectId" placeholder="编程世界ID" required>
                    <div id="projectIdError" class="error-message">请输入有效的编程世界ID</div>
                </div>
                <div class="form-group">
                    <label for="projectId">建模世界ID</label>
                    <input type="text" id="projectId" name="projectId" placeholder="请输入建模世界ID" required>
                    <div id="projectIdError" class="error-message">请输入有效的建模世界ID</div>
                </div>
                
                <button type="submit">上传</button>
            </form>
        </div>
    </div>

    <div id="ruler" style="padding-bottom: 20px;">
        <div style="text-align: left; margin-bottom: 10px; width: 100%; font-size: larger; font-weight: 700;"><span>比赛规则</span></div>
        <div id="child" style="overflow-x:auto;margin-top:8px;">
            <!-- 列表样式 小学组 -->
            <div class="table-wrapper" style="overflow-x:auto;margin-top:8px;">
                <style>
                    .score-table {
                        width: 100%;
                        border-collapse: collapse;
                        border: 1px solid #e6e6e6;
                        font-size: 14px;
                        color: #333;
                        box-shadow: 0 1px 3px rgba(0,0,0,0.03);
                        background: #fff;
                    }
                    .score-table caption {
                        text-align: left;
                        font-weight: 700;
                        padding: 8px 0;
                        font-size: 15px;
                        color: #222;
                    }
                    .score-table th,
                    .score-table td {
                        padding: 10px 12px;
                        border: 1px solid #eee;
                        text-align: left;
                        vertical-align: top;
                    }
                    .score-table thead th {
                        background: #f7f7f7;
                        font-weight: 600;
                        color: #444;
                    }
                    .score-table tbody tr:nth-child(odd) {
                        background: #fafafa;
                    }
                    .score-table tbody tr:hover {
                        background: #f2f8ff;
                    }
                    @media (max-width: 520px) {
                        .score-table th,
                        .score-table td {
                            padding: 8px;
                            font-size: 13px;
                        }
                    }
                </style>

                <table class="score-table" aria-describedby="小学组任务与分值">
                    <caption style="font-size: medium; font-weight: 600;">小学组任务与分值</caption>
                    <thead>
                        <tr>
                            <th>项目</th>
                            <th>任务说明</th>
                            <th>分值</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>出发</td>
                            <td>机器人离开充电舱并信号交互成功</td>
                            <td>10 分</td>
                        </tr>
                        <tr>
                            <td>陨石采集</td>
                            <td>将方块放置于同色平台：每个 10 分；放置于不同色平台：每个 2 分。信号交互成功计分（最多6次）</td>
                            <td>每个 10 或 2 分（最多6次）</td>
                        </tr>
                        <tr>
                            <td>返回充电舱</td>
                            <td>机器人静止于充电舱内并与基站完成信号交互</td>
                            <td>10 分</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        
        <div id="middle" class="table-wrapper" style="overflow-x:auto;margin-top:8px;">
            <table class="score-table" aria-describedby="初中组任务与分值">
                <caption style="font-size: medium; font-weight: 500;">初中组任务与分值</caption>
                <thead>
                <tr>
                    <th>项目</th>
                    <th>任务说明</th>
                    <th>分值</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>出发</td>
                    <td>触发成功</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>确认敌方情报</td>
                    <td>语音播报并正确识别。(识别设备显示有矩形框住二维码)</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>破坏敌方飞艇</td>
                    <td>命中正确目标</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>确认潜伏目标</td>
                    <td>语音播报并正确识别(识别设备显示有矩形框住二维码)</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>射击敌方基地</td>
                    <td>识别正确(识别设备显示目标名字、有矩形框框住目标)播报“发现X号目标”后射击对应X号目标</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>确认潜伏目标</td>
                    <td>在三个图像中射击正确目标10分(射击错误目标不得分)</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>前往星球基地识别区识</td>
                    <td>语音播报正确并正确识别，(识别设备显示有矩形框住二维码)</td>
                    <td>10 分</td>
                </tr>
                <tr>
                    <td>返回基地</td>
                    <td>播报“任务己完成正在充电”并停在正确的充电站(四个轮子都在方框内)</td>
                    <td>10 分</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <div id="tasks" class="gauss" style="height: fit-content; padding: 16px; margin: 12px;"> <!-- 建模任务-->
        <style>
            /* 高斯模糊与样式 */
            #tasks.gauss {
                background: rgba(255, 255, 255, 0.65);
                -webkit-backdrop-filter: blur(8px);
                backdrop-filter: blur(8px);
                border-radius: 10px;
                padding: 12px;
                margin: 8px 0;
            }

            /* 图片容器布局 */
            #tasks .images {
                display: flex;
                gap: 12px;
                margin-top: 8px;
                flex-wrap: wrap;
            }

            #tasks img {
                display: block;
                border-radius: 6px;
            }
            
            .images {
                width: 100%;
                display: flex;
                justify-content: space-around;
            }

            .images img {
                width: 49%;
            }

        </style>

        <div style="text-align: left; margin-bottom: 10px; width: 100%; font-size: larger; font-weight: 700;"><span>建模任务</span></div>

        <div><span style="font-size: medium; font-weight: 500;">太空休眠舱: </span> 枕头和被子不能是同一个颜色，底座的长是17，宽度是12，太空休眠舱主体的长和宽不能超过底座的长和宽</div>
        <div class="images">
            <img src="./Resource/sleep_1.png" alt="休眠舱1">
            <img src="./Resource/sleep_2.png" alt="休眠舱2">
        </div>

        <div style="margin-top: 40px;"><span style="font-size: medium; font-weight: 500;">金字塔：</span>搭建出下面的金字塔模型</div>
        <div class="images" style="margin-top:8px;">
            <img src="./Resource/jin.png" style="width: 70%;" alt="金字塔">
        </div>
    </div>
</div>



    <script>
        document.getElementById('loginForm').addEventListener('submit', function(e) {
            e.preventDefault();
            
            // 重置错误消息
            document.querySelectorAll('.error-message').forEach(el => {
                el.style.display = 'none';
            });
            
            // 获取表单值
            const name = document.getElementById('name').value.trim();
            const idCard = document.getElementById('idCard').value.trim();
            const projectId = document.getElementById('projectId').value.trim();
            
            let isValid = true;
            
            // 验证姓名
            if (name.length < 2) {
                document.getElementById('nameError').style.display = 'block';
                isValid = false;
            }
            
            // 验证身份证号 (简单验证18位)
            const idCardRegex = /^\d{17}[\dXx]$/;
            if (!idCardRegex.test(idCard)) {
                document.getElementById('idCardError').style.display = 'block';
                isValid = false;
            }
            
            // 验证项目ID (简单非空验证)
            if (projectId.length === 0) {
                document.getElementById('projectIdError').style.display = 'block';
                isValid = false;
            }
            
            // 如果验证通过，跳转到成功页面
            if (isValid) {
                // 使用URLSearchParams传递参数
                const params = new URLSearchParams();
                params.append('name', name);
                params.append('idCard', idCard);
                params.append('projectId', projectId);
                
                // 跳转到成功页面并携带参数
                // window.location.href = `上传成功${params.toString()}`;
                window.location.href = `./Login.html?${params.toString()}`;
            }
        });
    </script>
</body>
</html>